package com.cloud.lesson.config;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author: Mr.Lai
 * @createTime: 2021/01/11
 * @classNote:
 **/
@Configuration
public class GateWayConfig {

    @Bean
    public RouteLocator customRouteLocator(RouteLocatorBuilder routeLocatorBuilder){
        RouteLocatorBuilder.Builder routes = routeLocatorBuilder.routes();
        routes.route("path_route_cloudlesson",
                // 指定地址跳转目标地址
                r -> r.path("/guonei").uri("http://news.baidu.com/guonei"));
        return routes.build();
    }





}
